package site;

import java.io.IOException;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.oreilly.servlet.MultipartRequest;

/**
 * Servlet implementation class ReunionServlet2
 */
public class ReunionServlet2 extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	@EJB
	ReunionManager rm ;
	
	/**
     * @see HttpServlet#HttpServlet()
     */
    public ReunionServlet2() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		MultipartRequest multi= new MultipartRequest(request,"C:/Users/Client/Desktop/Files");
		String name = (String) multi.getFileNames().nextElement();
		String compteRendu = multi.getFilesystemName(name);
		compteRendu = "ftp://Rayen@127.0.0.1" + "/" + compteRendu;
		rm.ajouterCompteRenduReunion(compteRendu);
		request.getRequestDispatcher("reunionAjoutee.html").forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	 doGet (request,response);
	}

}
